﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Ue.Framework.Web;
using Ue.Infrastructure.RepositoryFramework;
using Ue.Qcdz.Domain.SaleInfos;

namespace Ue.Qcdz.UI.Controller
{
    public class SaleInfoController : Ue.Infrastructure.Web.AsyncHandlers.AsyncResult
    {
        private ISaleInfoRepository saleInfoRepository;
        private SaleInfo saleInfo;
        public SaleInfoController(AsyncCallback callback, HttpContext context, object state) : base(callback, context, state)
        {
            saleInfoRepository = RepositoryFactory.GetRepository<ISaleInfoRepository, SaleInfo>();
            saleInfo= saleInfoRepository[context.Request.GetQueryValue<Guid>("SaleInfoId")];
        }
        public string ChangeIsHot()
        {
            saleInfo.ChangeIsHot();
            saleInfoRepository[saleInfo.Key] = saleInfo;
            return saleInfo.IsHot.ToString();
        }
        public string ChaneIsTop()
        {
            saleInfo.ChangeIsTop();
            saleInfoRepository[saleInfo.Key] = saleInfo;
            return saleInfo.IsTop.ToString();
        }
    }
}
